﻿using System;

namespace OpenShape
{
    class GeoPolyline : Geometry
    {
        public GeoPolyline()
        {
            //
            // TODO: 여기에 생성자 논리를 추가합니다.
            //			
        }
        public GeoPolyline(GeoPolyline previousGeoPolyline)
        {
            //
            // TODO: 여기에 복사 생성자 논리를 추가합니다.
            //			
            this.m_id = previousGeoPolyline.m_id;
            this.m_nNumParts = previousGeoPolyline.m_nNumParts;
            this.m_nNumPoints = previousGeoPolyline.m_nNumPoints;
            this.m_pParts = previousGeoPolyline.m_pParts;
            this.m_pPoints = previousGeoPolyline.m_pPoints;
            this.m_Rect = previousGeoPolyline.m_Rect;
        }
        public override int Id
        {
            get
            {
                return this.m_id;
            }
            set
            {
                this.m_id = value;
            }
        }

        public override int NumParts
        {
            get
            {
                return this.m_nNumParts;
            }
            set
            {
                this.m_nNumParts = value;
            }
        }

        public override int NumPoints
        {
            get
            {
                return this.m_nNumPoints;
            }
            set
            {
                this.m_nNumPoints = value;
            }
        }

        public override Geometry.PartCollection Parts
        {
            get
            {
                return this.m_pParts;
            }
        }

        public override Geometry.PointCollection Points
        {
            get
            {
                return this.m_pPoints;
            }
        }

        public override void SetRect(byte[] ByteArray)
        {
            byte[] temp_Xmin = new byte[8];
            byte[] temp_Ymin = new byte[8];
            byte[] temp_Xmax = new byte[8];
            byte[] temp_Ymax = new byte[8];

            for (int i = 0; i < 8; i++)
            {
                temp_Xmin[i] = ByteArray[i];
                temp_Ymin[i] = ByteArray[i + 8];
                temp_Xmax[i] = ByteArray[i + 16];
                temp_Ymax[i] = ByteArray[i + 24];
            }
            this.m_Rect.xmin = BitConverter.ToDouble(temp_Xmin, 0);
            this.m_Rect.ymin = BitConverter.ToDouble(temp_Ymin, 0);
            this.m_Rect.xmax = BitConverter.ToDouble(temp_Xmax, 0);
            this.m_Rect.ymax = BitConverter.ToDouble(temp_Ymax, 0);
        }

        public override GeoRect MBR
        {
            get
            {
                return this.m_Rect;
            }
        }
    }
}
